package com.study.zzedu.adapter;

import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import android.support.v4.view.PagerAdapter;
import android.view.ViewGroup;

import com.study.zzedu.ui.schoolroll.fragment.BaseTabForStuInfoFragment;

import java.util.List;


public class TabForStuInfoAdapter extends FragmentStatePagerAdapter {
    private List<String> list;

    public TabForStuInfoAdapter(FragmentManager fm, List<String> list) {
        super(fm);
        this.list = list;
    }

    @Override
    public Fragment getItem(int position) {
        return BaseTabForStuInfoFragment.newInstance(position);
    }

    @Override
    public int getCount() {
        if(list != null)
            return list.size();
        else
            return 0;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return list.get(position);
    }

    @Override
    public void destroyItem(ViewGroup container, int position, Object object) {
        super.destroyItem(container, position, object);
    }

    @Override
    public int getItemPosition(@NonNull Object object) {
        return PagerAdapter.POSITION_NONE;
    }
}
